package com.basker.pisces.core.meta.bean;

import com.basker.pisces.core.meta.IDataField;
import com.basker.pisces.core.meta.IDataObjectMeta;
import com.basker.pisces.core.meta.ReferenceField;

public class BeanReferenceField extends ReferenceField {

    private BeanFieldDescriptor beanFieldDescriptor;

    protected BeanReferenceField(BeanFieldDescriptor beanFieldDescriptor, String name, String displayName,
                                 IDataObjectMeta refObjectMeta, IDataField refrenceIdField) {
        super(name, displayName, refObjectMeta, refrenceIdField);

        this.beanFieldDescriptor = beanFieldDescriptor;
    }

    @Override
    public Object getValue(Object dataObject) {
        return this.beanFieldDescriptor.getValue(dataObject);
    }

    @Override
    protected void internalSetValue(Object dataObject, Object value) {
        this.beanFieldDescriptor.setValue(dataObject, value);
    }

}
